package com.bhs.sansong.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansong.R;
import com.bhs.sansong.bean.TabBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class ScreenAdapter extends BaseQuickAdapter<TabBean, BaseViewHolder> {

    public boolean isHaveChoice = true;//是否可以选

    public ScreenAdapter() {
        super(R.layout.item_line);
    }

    public ScreenAdapter(@Nullable List<TabBean> data) {
        super(R.layout.item_line, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, TabBean item) {
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.getTypeName());
        if (item.isChecked()) {
            tvName.setBackgroundResource(R.drawable.bg_blue_4);
            tvName.setTextColor(mContext.getColor(R.color.white));
        } else {
            if (isHaveChoice) {
                tvName.setTextColor(mContext.getColor(R.color.black));
                tvName.setBackgroundResource(R.drawable.bg_grey_4);
            } else {
                tvName.setTextColor( mContext.getColor(R.color.black_7f));
                tvName.setBackgroundResource(R.drawable.bg_cannot);
            }
        }


    }
}
